import tseslint from 'typescript-eslint';

const prettierRecommended = await import('eslint-plugin-prettier/recommended');

export default await tseslint.config({
  files: ['**/*.ts', '**/*.tsx'],
  languageOptions: {
    parserOptions: {
      project: ['./tsconfig.json'],
    },
  },
  plugins: {
    prettier: await import('eslint-plugin-prettier'),
  },
  rules: {
    // 这里可以添加自定义规则
    'prettier/prettier': 'error',
    '@typescript-eslint/no-unused-vars': 'warn',
    '@typescript-eslint/explicit-function-return-type': 'off',
  },
  ignores: ['dist', 'node_modules'],
  extends: [prettierRecommended.default], // ✅ 取 default 导出
});
